package com.lmiot.xyclick.Util;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

public class ListUtil {
    public static <T> List<List<T>> partList(List<T> list, int i) {
        if (list == null || i == 0) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        int size = list.size();
        int i2 = size % i;
        PrintStream printStream = System.out;
        printStream.println("余数:" + i2);
        int i3 = size / i;
        PrintStream printStream2 = System.out;
        printStream2.println("商:" + i3);
        int i4 = 0;
        while (i4 < i3) {
            int i5 = i4 * i;
            i4++;
            arrayList.add(list.subList(i5, i4 * i));
        }
        if (i2 > 0) {
            arrayList.add(list.subList(size - i2, size));
        }
        return arrayList;
    }
}
